package com.ruoyi.system.service.impl;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.SensorParameters;
import com.ruoyi.system.mapper.SensorParametersMapper;
import com.ruoyi.system.service.ISensorParametersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 传感器参数Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-04-10
 */
@Service
public class SensorParametersServiceImpl implements ISensorParametersService 
{
    @Autowired
    private SensorParametersMapper sensorParametersMapper;

    /**
     * 查询传感器参数
     * 
     * @param id 传感器参数主键
     * @return 传感器参数
     */
    @Override
    public SensorParameters selectSensorParametersById(Long id)
    {
        return sensorParametersMapper.selectSensorParametersById(id);
    }

    /**
     * 查询传感器参数列表
     * 
     * @param sensorParameters 传感器参数
     * @return 传感器参数
     */
    @Override
    public List<SensorParameters> selectSensorParametersList(SensorParameters sensorParameters)
    {
        return sensorParametersMapper.selectSensorParametersList(sensorParameters);
    }

    /**
     * 新增传感器参数
     * 
     * @param sensorParameters 传感器参数
     * @return 结果
     */
    @Override
    public int insertSensorParameters(SensorParameters sensorParameters)
    {
        sensorParameters.setCreateTime(DateUtils.getNowDate());
        return sensorParametersMapper.insertSensorParameters(sensorParameters);
    }

    /**
     * 修改传感器参数
     * 
     * @param sensorParameters 传感器参数
     * @return 结果
     */
    @Override
    public int updateSensorParameters(SensorParameters sensorParameters)
    {
        sensorParameters.setUpdateTime(DateUtils.getNowDate());
        return sensorParametersMapper.updateSensorParameters(sensorParameters);
    }

    /**
     * 批量删除传感器参数
     * 
     * @param ids 需要删除的传感器参数主键
     * @return 结果
     */
    @Override
    public int deleteSensorParametersByIds(String ids)
    {
        return sensorParametersMapper.deleteSensorParametersByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除传感器参数信息
     * 
     * @param id 传感器参数主键
     * @return 结果
     */
    @Override
    public int deleteSensorParametersById(Long id)
    {
        return sensorParametersMapper.deleteSensorParametersById(id);
    }

    @Override
    public SensorParameters selectSensorParametersBySite(String site) {
        return sensorParametersMapper.selectSensorParametersBySite(site);
    }

    @Override
    public int updateSensorParametersBySite(String site) {
        return sensorParametersMapper.updateSensorParametersBySite(site);
    }

    @Override
    public SensorParameters selectSensorParameters() {
        return sensorParametersMapper.selectSensorParameters();
    }

    @Override
    public int updateSensorParametersStatus() {
        return sensorParametersMapper.updateSensorParametersStatus();
    }
}
